package com.coolwen.permission;

import org.apache.log4j.Logger;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.authz.permission.PermissionResolver;
import org.apache.shiro.authz.permission.WildcardPermission;

/**
 * Created by user on 2016/6/26.
 */
public class UrlPermissionResovler implements PermissionResolver {

    private Logger logger = Logger.getLogger(getClass());

    @Override
    public Permission resolvePermission(String permissionString) {
//        logger.info("进入UrlPermissionResovler:" +permissionString);
        if (permissionString.startsWith("/")) {
        //    logger.info("进入UrlPermissionResovler:" +new UrlPermission(permissionString));
            return new UrlPermission(permissionString);
        }
        return new WildcardPermission(permissionString);
    }
}
